<template>
  <div>
    <!-- 头部 --start-->
    <div class="nav">
      <!-- <p v-if="state==true">
        <span>.</span> 考勤核对
      </p>-->
      <p>
        <span>.</span> 薪资详情
      </p>
      <div id="nav_go">
        <el-button type="info" icon="el-icon-back" class="btn_fanhui" @click="revert()">返回</el-button>
      </div>
    </div>
    <!-- 头部 --end-->
    <div id="table_conter">
      <div class="title">{{item.depart}}{{item.year}}年{{item.month}}月考勤表</div>
      <div style>
        <template>
          <el-table
            :data="tableData"
            style="width: 98%;margin:0 auto;border:1px solid #EBEEF5"
            height="550"
          >
            <el-table-column prop="name" label="姓名" width="70"></el-table-column>
            <el-table-column prop="postSalary" label="岗位工资"></el-table-column>
            <el-table-column prop="meritPay" label="绩效工资"></el-table-column>
            <el-table-column prop="seniorityPay" label="工龄工资"></el-table-column>
            <el-table-column prop="overtimeWage" label="加班工资"></el-table-column>
            <el-table-column prop="examineDeductions" label="考核扣款"></el-table-column>
            <el-table-column prop="absenceDeductions" label="缺勤扣款"></el-table-column>
            <el-table-column prop="coefficient" label="单台绩效系数"></el-table-column>
            <el-table-column prop="salary" label="应发工资"></el-table-column>
            <el-table-column prop="endowment" label="养老险"></el-table-column>
            <el-table-column prop="unemployment" label="失业保险"></el-table-column>
            <el-table-column prop="MedicalInsurance" label="医疗险"></el-table-column>
            <el-table-column prop="ProvidentFund" label="公积金"></el-table-column>
            <el-table-column prop="reinforcedButton" label="补扣五险一金"></el-table-column>
            <el-table-column prop="incometax" label="应扣个税"></el-table-column>
            <el-table-column prop="utilities" label="宿舍水电费"></el-table-column>
            <el-table-column prop="netPayroll" label="实发工资"></el-table-column>
            <!-- <el-table-column prop="Name" label="补扣五险一金" ></el-table-column>
            <el-table-column prop="Name" label="补扣五险一金" ></el-table-column>-->
          </el-table>
        </template>
      </div>
      <div class="btn_bottom" v-show="shows==0">
        <el-button type="primary" size="medium" @click="queDing()">发放</el-button>
        <el-button type="info" size="medium" @click="revert()">返回</el-button>
      </div>
    </div>
  </div>
</template>
<script>
import axios from "axios";
export default {
  data () {
    return {
      id: "",
      item: { depart: "", year: "", month: "", },
      tableData: [],
      arr: [],
      shows: 1,
      Mark: 0
    };
  },
  created () {
    this.id = this.$route.query.e;
    this.shows = this.$route.query.shows;
    this.getxq();
  },
  methods: {
    queDing () {
      if (this.Mark == 0) {
        var obj = { id: this.id };
        var objs = JSON.stringify(obj);
        let the = { index: 1, jsondata: objs };
        this.Mark = 1;
        axios.post("/apis/FinanceManage.asmx/Examine", the).then(({ data }) => {
          var list = JSON.parse(data.d);
          if (list.flag == true) {
            this.$message.success(list.tip); this.$router.go(-1);
          }
          else { this.$message.error(list.tip); }
        });
      }
    },
    //返回
    revert () {
      this.$router.go(-1);
    },
    //详情数据
    getxq () {
      var obj = { id: this.id };
      var objs = JSON.stringify(obj); let the = { index: 15, jsondata: objs };
      console.log(objs)
      axios.post("/apis/PersonnelMatters.asmx/GetData", the).then(({ data }) => {
        var list = JSON.parse(data.d);
        if (list == null) { this.$message.error("数据异常"); }
        else {
          this.item = list.basemess;
          this.tableData = list.det
        }
      })
    },
    //通过驳回
    pass (a) {
      let arr = { id: 2, date: this.date, depart: this.depart, sid: a };
      let arr1 = JSON.stringify(arr);
      axios(
        "apis/PersonnelManagement.asmx/Checkingin?index=3&jsondata=" +
        arr1 +
        "&empno=" +
        this.empno
      ).then(({ data }) => {
        let data1 = this.$x2js.xml2js(data);
        let data3 = data1.string.__text;
        console.log(data3);
        if (data3 == "核对成功") {
          this.$message({
            message: "核对成功",
            type: "success"
          });
        }
        this.$router.go(-1);
        if (data3 == "已驳回") {
          this.$message.error("已驳回");
        }
        this.$router.go(-1);
      });
    }
  }
};
</script>
<style lang="scss" scoped>
@import '@/assets/scss/base.scss';
.btn_bottom {
  margin-top: 30px;
  margin-left: 45%;
}
.nav {
  //border: solid 1px red;
  height: 60px;
  padding: 0 1%;
  position: relative;
  p {
    height: 40px;
    margin: 10px 0;
    line-height: 40px;
    span {
      background: $Header_color;
      color: $Header_color;
    }
  }
  #nav_go {
    position: absolute;
    top: 10px;
    right: 1%;
    img {
      height: 16px;
      padding-right: 10px;
    }
  }
}
.buttom {
  text-align: center;
  margin-top: 10px;
}
#table_conter {
  background: #fff;
  width: 98%;
  margin: 0 auto;
  padding: 10px 0;
}
#table_conter .title {
  text-align: center;
  height: 50px;
  line-height: 50px;
}
</style>
<style >
#table_conter .el-table thead.is-group th {
  background: #fff;
}
#table_conter .el-table th > .cell {
  text-align: center;
  padding: 0;
}
#table_conter .el-table {
  font-size: 14px;
}
#table_conter .el-table td,
.el-table th {
  padding: 0;
  height: 40px;
}
#table_conter .el-table .cell {
  line-height: normal;
  padding: 0;
}
#table_conter .el-table .cell,
.el-table--border td:first-child .cell,
.el-table--border th:first-child .cell {
  padding: 0;
}
#table_conter .el-table th.gutter {
  display: table-cell !important;
}
#table_conter .el-table .cell {
  text-align: center;
}
</style>